package com.itheima.InetAddressdemo;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class MyInetAddressDemo1 {
    public static void main(String[] args) throws UnknownHostException {

/*
        static InetAddress getByName
        String getHostName
        String getHostAddress
*/
        //ip的对象，ip又比作网络中某电脑
        InetAddress address=InetAddress.getByName("灵溪泽");
        System.out.println(address);
        System.out.println(address.getHostName());//名称,返回ip就是没网
        System.out.println(address.getHostAddress());//ip

    }
}
